// Learn cc.Class:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
// Learn Attribute:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
// Learn life-cycle callbacks:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html

/*
 * 自制键盘界面
 */
cc.Class({
    extends: cc.Component,

    properties: {
        _callBack:null,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {
    },

    init:function(call){
        this._callBack = call;
    },

    //点击键盘，回调
    onClickEvent:function(event,customEventData){
        if(this._callBack)
            this._callBack(customEventData);
    },

    //键盘显示
    onShow:function(){
        this.node.setPosition(0,-1300);
        this.node.runAction(cc.moveTo(0.2, cc.p(0,-618)));
        
    },

    //键盘隐藏
    onHide:function(){
        this.node.setPosition(0,-618);
        this.node.runAction(cc.moveTo(0.2, cc.p(0,-1300)));
        
    },

    onClose:function(){
        this.node.destroy();
    }

    // update (dt) {},
});
